home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AEparticleEditComponent.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  21.7 KB  |  850 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17.  
  18. //  ========== pEditCompSetAttrCB ==========
  19. //
  20. //  Description:
  21. //     User has selected the "Set Attribute" in the Edit Component
  22. //        dialog; so set the selected attribute with the correct values.
  23. //
  24. global proc pEditCompSetAttrCB(string $nodeName,
  25.                 string $attrName, string $attrType)
  26. {
  27.     // global string $dynParticleSaveParent;
  28. //    setParent $dynParticleSaveParent;
  29.  
  30.     string $cmd;
  31.  
  32.     if (size($attrName) == 0)
  33.     {
  34.         warning "No valid attribute is selected.";
  35.         return;
  36.     }
  37.     int $relative = `checkBoxGrp -q -v1 particleRelativeCB`;
  38.     int $editType = `radioButtonGrp -q -sl pEditCompRB`;
  39.  
  40.     if ($attrType == "Float")
  41.     {
  42.         float $offset = `floatSliderGrp -q -v particleRandomOffset`;
  43.         float $value = `floatSliderGrp -q -v particleComponentVal`;
  44.  
  45.         if ($editType == 1)
  46.         {
  47.              $cmd = "setParticleAttr -at "+$attrName+" -fv "+ $value +" -rf "+$offset + " -r " +$relative;
  48.  
  49.             evalEcho $cmd;
  50.         }
  51.         else
  52.         {
  53.              $cmd = "setParticleAttr -at "+$attrName+" -fv "+ $value +" -rf "+$offset + " -r " +$relative +" -o "+$nodeName;
  54.  
  55.             evalEcho $cmd;
  56.         }
  57.  
  58.     }
  59.     else
  60.     {
  61.         float $offsetX = `floatSliderGrp -q -v particleRandomOffsetX`;
  62.         float $offsetY = `floatSliderGrp -q -v particleRandomOffsetY`;
  63.         float $offsetZ = `floatSliderGrp -q -v particleRandomOffsetZ`;
  64.         float $valueX = `floatSliderGrp -q -v particleComponentValX`;
  65.         float $valueY = `floatSliderGrp -q -v particleComponentValY`;
  66.         float $valueZ = `floatSliderGrp -q -v particleComponentValZ`;
  67.  
  68.  
  69.         if ($editType == 1)
  70.         {
  71.              $cmd = "setParticleAttr -at "+$attrName+" -vv "+$valueX+" "+$valueY+" "+$valueZ+" -rv "+$offsetX+" "+$offsetY+" "+$offsetZ+" -r " +$relative;
  72.  
  73.             evalEcho $cmd;
  74.         }
  75.         else
  76.         {
  77.              $cmd = "setParticleAttr -at "+$attrName+" -vv "+$valueX+" "+$valueY+" "+$valueZ+" -rv "+$offsetX+" "+$offsetY+" "+$offsetZ+" -r " +$relative+" -o "+$nodeName;
  78.             evalEcho $cmd;
  79.         }
  80.     }
  81.  
  82.     pEditCompSetAverage($nodeName, $attrName, $attrType, $editType);
  83.  
  84.     int $saveState = `checkBoxGrp -q -v2 particleRelativeCB`;;
  85.  
  86.     if ($saveState)
  87.     {
  88.         evalEcho("saveInitialState -attribute " + $attrName + " " +$nodeName);
  89.     }
  90.  
  91. }  // pEditCompSetAttrCB
  92.  
  93.  
  94.  
  95. global proc pEditCompSetAverage(string $nodeName, 
  96.                 string $attrName,
  97.                 string $attrType, 
  98.                 int $editType)
  99. {
  100.     if (!`attributeQuery -exists -node $nodeName $attrName`)
  101.     {
  102.         warning ("Attribute \"" + $attrName 
  103.             + "\" does not exist on node \""
  104.             + $nodeName + "\"" );
  105.         textFieldGrp -e -en 1 pEditCompAttrTF;
  106.         checkBoxGrp -e -en 0 particleRelativeCB;
  107.         radioButtonGrp -e -en 0 pEditCompRB;
  108.         tabLayout -e -en 0 pEditCompValsTL;
  109.  
  110.         rowLayout -e -en 0 particleEditCompAverageValue;
  111.         rowLayout -e -en 0 particleEditCompMaxAverageOffset;
  112.  
  113.         return;
  114.     } else {
  115.         float $average[6];
  116.  
  117.         if ($editType == 2)
  118.             $average = `getParticleAttr -at $attrName -o $nodeName`;
  119.         else
  120.             $average = `getParticleAttr -at $attrName`;
  121.     
  122.         if ($attrType == "Float")
  123.         {
  124.             floatField -e -v $average[0] particleEditCompAverageValueX;
  125.             floatField -e 
  126.                 -vis 0 particleEditCompAverageValueY;
  127.             floatField -e 
  128.                 -vis 0 particleEditCompAverageValueZ;
  129.             floatField -e -v $average[1] particleEditCompMaxAverageOffsetX;
  130.             floatField -e 
  131.                 -vis 0 particleEditCompMaxAverageOffsetY;
  132.             floatField -e 
  133.                 -vis 0 particleEditCompMaxAverageOffsetZ;
  134.         }
  135.         else
  136.         {
  137.             floatField -e -v $average[0] particleEditCompAverageValueX;
  138.             floatField -e 
  139.                 -vis 1 -v $average[1] particleEditCompAverageValueY;
  140.             floatField -e 
  141.                 -vis 1 -v $average[2] particleEditCompAverageValueZ;
  142.     
  143.             floatField -e -v $average[3] particleEditCompMaxAverageOffsetX;
  144.             floatField -e 
  145.                 -vis 1 -v $average[4] particleEditCompMaxAverageOffsetY;
  146.             floatField -e 
  147.                 -vis 1 -v $average[5] particleEditCompMaxAverageOffsetZ;
  148.         }
  149.     }
  150. }  // pEditCompSetAverage
  151.  
  152.  
  153.  
  154. // ****************************************************************
  155. //
  156. //                  COMPONENT EDITOR PROCEDURES
  157. //
  158. // ****************************************************************
  159.  
  160. global proc pEditCompSetSliderLabels(string $attrName)
  161. {
  162.         if ($attrName != "rgbPP")
  163.         {
  164.             floatSliderGrp -e -l "X" particleComponentValX;
  165.             floatSliderGrp -e -l "Y" particleComponentValY;
  166.             floatSliderGrp -e -l "Z" particleComponentValZ;
  167.             floatSliderGrp -e -l "X" particleRandomOffsetX;
  168.             floatSliderGrp -e -l "Y" particleRandomOffsetY;
  169.             floatSliderGrp -e -l "Z" particleRandomOffsetZ;
  170.         }
  171.         else
  172.         {
  173.             floatSliderGrp -e -l "R" particleComponentValX;
  174.             floatSliderGrp -e -l "G" particleComponentValY;
  175.             floatSliderGrp -e -l "B" particleComponentValZ;
  176.             floatSliderGrp -e -l "R" particleRandomOffsetX;
  177.             floatSliderGrp -e -l "G" particleRandomOffsetY;
  178.             floatSliderGrp -e -l "B" particleRandomOffsetZ;
  179.         }
  180. }
  181.  
  182.  
  183.  
  184. //  ========== pEditCompGetAttrCB ==========
  185. //
  186. //  Description:
  187. //     User has selected the "Get Attribute" in the Edit Component
  188. //       dialog; so get the values of the selected attribute.
  189. //
  190. global proc pEditCompGetAttrCB(string $nodeName,
  191.                 string $attrName, 
  192.                 string $attrType)
  193. {
  194.     global string $dynParticleSaveParent;
  195. //    setParent $dynParticleSaveParent;
  196.  
  197.  
  198.     int $editType = `radioButtonGrp -q -sl pEditCompRB`;
  199.  
  200.     pEditCompSetAverage($nodeName, $attrName, $attrType, $editType);
  201.  
  202.  
  203. }  // pEditCompGetAttrCB
  204.  
  205.  
  206.  
  207.  
  208. //  ========== pEditCompSelectTypeCB ==========
  209. //
  210. //  Description:
  211. //     User has changed the selection method (object, selected comps).
  212. //       If editing whole object, enable the object name textfield.
  213. //     If editing selected components, disable it.
  214. //
  215. global proc pEditCompSelectTypeCB(string $nodeName,
  216.                 string $attrName,
  217.                 string $attrType,
  218.                 int $editType)
  219. {
  220.     global string $dynParticleSaveParent;
  221. //    setParent $dynParticleSaveParent;
  222.  
  223.     textFieldGrp -e -text $nodeName pEditCompObjTF;
  224.     if ($editType == 2)
  225.     {
  226.         textFieldGrp -e -enable true pEditCompObjTF;
  227.     }
  228.     else
  229.     {
  230.         textFieldGrp -e -enable false pEditCompObjTF;
  231.     }
  232.  
  233.     pEditCompSetAverage($nodeName, $attrName, $attrType, $editType);
  234.  
  235. }  // pEditCompSelectTypeCB
  236.  
  237.  
  238.  
  239.  
  240.  
  241. //  ========== pEditCompAttrNameCB ==========
  242. //
  243. //  Description:
  244. //     User has changed the attribute name.
  245. //       Get the values for the new attribute, and reset appropriate
  246. //       callbacks.
  247. //
  248. global proc pEditCompAttrNameCB( string $attrName )
  249. {
  250.     global string $dynParticleSaveParent;
  251. //    setParent $dynParticleSaveParent;
  252.  
  253. //    string $attrName = `textFieldGrp -q -text pEditCompAttrTF`;
  254.     string $nodeName = `textFieldGrp -q -text pEditCompObjTF`;
  255.  
  256.     // If the attribute doesn't exist, warn the user and return.
  257.     // I can only do this if there is an object name.
  258.     //
  259.     if (size($nodeName) > 0)
  260.     {
  261.         if (!`attributeQuery -exists -node $nodeName $attrName`)
  262.         {
  263.             warning ("Attribute \"" + $attrName 
  264.                 + "\" does not exist on node \""
  265.                 + $nodeName + "\"" );
  266.             
  267.             checkBoxGrp -e -en 0 particleRelativeCB;
  268.             radioButtonGrp -e -en 0 pEditCompRB;
  269.             tabLayout -e -en 0 pEditCompValsTL;
  270.  
  271.  
  272.             rowLayout -e -en 0 particleEditCompAverageValue;
  273.             rowLayout -e -en 0 particleEditCompMaxAverageOffset;
  274.  
  275.             return;
  276.         } else {
  277.             
  278.             checkBoxGrp -e -en 1 particleRelativeCB;
  279.             radioButtonGrp -e -en 1 pEditCompRB;
  280.             tabLayout -e -en 1 pEditCompValsTL;
  281.  
  282.  
  283.             rowLayout -e -en 1 particleEditCompAverageValue;
  284.             rowLayout -e -en 1 particleEditCompMaxAverageOffset;
  285.         }
  286.     }
  287.  
  288.     // Have to figure out what type it is;  first check the list
  289.     // of static array attributes.  If it's not in there, then get
  290.     // the list of dynamic attributes from the particle command, 
  291.     // and check it out.
  292.     // Also, it has to be a float or vector array type.
  293.     //
  294.     string $attrType;
  295.  
  296.     if ($attrName == "position" || 
  297.         $attrName == "velocity" ||
  298.         $attrName == "acceleration")
  299.     {
  300.         $attrType = "Vector";
  301.             tabLayout -e
  302.             -selectTab pEditCompVecValsCL
  303.             pEditCompValsTL;
  304.         radioButtonGrp -e
  305.             -cc2 ("pEditCompSelectTypeCB "
  306.                 +$nodeName+" "
  307.                 +$attrName+" "
  308.                 +" Vector 2")
  309.             -cc1 ("pEditCompSelectTypeCB "
  310.                 +$nodeName+" "
  311.                 +$attrName+" "
  312.                 +" Vector 1")
  313.                pEditCompRB;
  314.     }
  315.     else if ($attrName == "mass")
  316.     {
  317.         $attrType = "Float";
  318.         tabLayout -e
  319.             -selectTab pEditCompFloatValsCL
  320.             pEditCompValsTL;
  321.         radioButtonGrp -e
  322.             -cc2 ("pEditCompSelectTypeCB "
  323.                         +$nodeName+" "
  324.                         +$attrName+" "
  325.                         +" Float 2")
  326.             -cc1 ("pEditCompSelectTypeCB "
  327.                         +$nodeName+" "
  328.                         +$attrName+" "
  329.                         +" Float 1")
  330.                         pEditCompRB;
  331.     }
  332.     else
  333.     {
  334.         string $dynamicAttrList[] = `particle -q -dal $nodeName`;
  335.         int $numDynAttrs = size($dynamicAttrList);
  336.         if ($numDynAttrs > 0)
  337.         {
  338.             int $i;
  339.             string $dynTokenAry[];
  340.             for ($i = 0; $i < $numDynAttrs; $i++)
  341.             {
  342.                    tokenize( $dynamicAttrList[$i], ":", $dynTokenAry );
  343.  
  344.                 if ($dynTokenAry[0] == $attrName)
  345.                 {
  346.                     if ($dynTokenAry[1] == "vectorArray")
  347.                     {
  348.                         $attrType = "Vector";
  349.                             tabLayout -e
  350.                             -selectTab pEditCompVecValsCL
  351.                             pEditCompValsTL;
  352.                         radioButtonGrp -e
  353.                             -cc2 ("pEditCompSelectTypeCB "
  354.                                 +$nodeName+" "
  355.                                 +$attrName+" "
  356.                                 +" Vector 2")
  357.                             -cc1 ("pEditCompSelectTypeCB "
  358.                                 +$nodeName+" "
  359.                                 +$attrName+" "
  360.                                 +" Vector 1")
  361.                                     pEditCompRB;
  362.                         break;
  363.                     }
  364.                     else if ($dynTokenAry[1] == "doubleArray")
  365.                     {
  366.                         $attrType = "Float";
  367.                         tabLayout -e
  368.                             -selectTab pEditCompFloatValsCL
  369.                             pEditCompValsTL;
  370.                         radioButtonGrp -e
  371.                             -cc2 ("pEditCompSelectTypeCB "
  372.                                 +$nodeName+" "
  373.                                 +$attrName+" "
  374.                                 +" Float 2")
  375.                             -cc1 ("pEditCompSelectTypeCB "
  376.                                 +$nodeName+" "
  377.                                 +$attrName+" "
  378.                                 +" Float 1")
  379.                                     pEditCompRB;
  380.                         break;
  381.                     }
  382.                     else
  383.                     {
  384.                         warning "Attribute must be a float or vector per particle array.";
  385.                         return;
  386.                     }
  387.                 }
  388.             }
  389.             clear ($dynTokenAry);
  390.         }
  391.         clear ($dynamicAttrList);
  392.     }
  393.  
  394.     // If the new attr is rgbPP, have to set XYX slider labels to RGB, 
  395.     // otherwise set the labels to XYZ.
  396.     //
  397.     if ($attrType == "Vector")
  398.         pEditCompSetSliderLabels($attrName);
  399.  
  400.     button -e
  401.         -c ("pEditCompSetAttrCB "
  402.             +$nodeName+" "
  403.             +$attrName+" "
  404.             +$attrType)
  405.         pEditCompSetAttrBtn;
  406.  
  407.     button -e
  408.         -c ("pEditCompGetAttrCB "
  409.             +$nodeName+" "
  410.             +$attrName+" "
  411.             +$attrType)
  412.         pEditCompGetAttrBtn;
  413.  
  414.  
  415.     if (size($nodeName) == 0)
  416.         $nodeName = " ";
  417.     pEditCompGetAttrCB($nodeName, $attrName, $attrType);
  418.  
  419. }  // pEditCompAttrNameCB
  420.  
  421.  
  422.  
  423.  
  424. //  ========== pEditCompObjNameCB ==========
  425. //
  426. //  Description:
  427. //     User has changed the object name.
  428. //       Get the values for the new object, and reset appropriate
  429. //       callbacks.
  430. //
  431. global proc pEditCompObjNameCB( string $nodeName )
  432. {
  433.     global string $dynParticleSaveParent;
  434. //    setParent $dynParticleSaveParent;
  435.  
  436.     // MAKE SURE THE OBJ NAME IS CORRECT ????
  437.     //
  438.     string $attrName = `textFieldGrp -q -text pEditCompAttrTF`;
  439. //    string $nodeName = `textFieldGrp -q -text pEditCompObjTF`;
  440.  
  441.     if (`objExists $nodeName`)
  442.     {
  443.         // enable all the devices in case a wrong nodeName was entered
  444.         textFieldGrp -e -en 1 pEditCompAttrTF;
  445.         checkBoxGrp -e -en 1 particleRelativeCB;
  446.         radioButtonGrp -e -en 1 pEditCompRB;
  447.         tabLayout -e -en 1 pEditCompValsTL;
  448.  
  449.  
  450.         rowLayout -e -en 1 particleEditCompAverageValue;
  451.         rowLayout -e -en 1 particleEditCompMaxAverageOffset;
  452.  
  453.         // check for which tab is selected
  454.         int $whichTab = `tabLayout -q -selectTabIndex pEditCompValsTL`;
  455.  
  456.         if ($whichTab == 1)
  457.             $attrType = "Float";
  458.         else
  459.             $attrType = "Vector";
  460.     
  461.         button -e
  462.             -c ("pEditCompSetAttrCB "
  463.                 +$nodeName+" "
  464.                 +$attrName+" "
  465.                 +$attrType)
  466.             pEditCompSetAttrBtn;
  467.     
  468.         button -e
  469.             -c ("pEditCompGetAttrCB "
  470.                 +$nodeName+" "
  471.                 +$attrName+" "
  472.                 +$attrType)
  473.             pEditCompGetAttrBtn;
  474.     
  475.         pEditCompGetAttrCB($nodeName, $attrName, $attrType);
  476.     } else {
  477.         // disable all the widgets because an invalid node was
  478.         // entered
  479.         textFieldGrp -e -en 0 pEditCompAttrTF;
  480.         checkBoxGrp -e -en 0 particleRelativeCB;
  481.         radioButtonGrp -e -en 0 pEditCompRB;
  482.         tabLayout -e -en 0 pEditCompValsTL;
  483.  
  484.  
  485.         rowLayout -e -en 0 particleEditCompAverageValue;
  486.         rowLayout -e -en 0 particleEditCompMaxAverageOffset;
  487.  
  488.         warning ("The node \"" + $nodeName + "\" does not exist");
  489.         return;
  490.     }
  491.     
  492.  
  493. }  // pEditCompObjNameCB
  494.  
  495.  
  496.  
  497.  
  498. //  ========== AEparticleEditComponent ==========
  499. //
  500. //  Description:
  501. //     Bring up the Edit Component dialog.
  502. //
  503. global proc AEparticleEditComponent ( string $nodeName,
  504.                 string $attrName, 
  505.                 string $attrType)
  506. {
  507.     setUITemplate -pst attributeEditorTemplate;
  508.     
  509.     global float $dynMaxFloatField;
  510.     global float $dynMinFloatField;
  511.  
  512.     string $buffer[];
  513.     tokenize($nodeName, "|", $buffer);
  514.  
  515.     $nodeName = $buffer[size($buffer) - 1];
  516.  
  517.     if (!`window -exists "pEditCompWin"`)
  518.     {
  519.     window
  520.         -t "Particle Components"
  521.         -rtf false
  522.         -wh 460 460
  523.         pEditCompWin;
  524.  
  525.     setUITemplate -pst attributeEditorTemplate;
  526.  
  527.     // setup the main look of the window
  528.  
  529.     formLayout -nd 100 pEditCompBtnsF;
  530.  
  531.         columnLayout -adj false   pEditCompCL;
  532.         setParent ..;
  533.     
  534.         setUITemplate -pst attributeEditorPresetsTemplate;
  535.  
  536.         rowLayout -nc 4
  537.             -cat 1 right 5
  538.             -cat 2 both 0
  539.             -cat 3 both 0
  540.             -cat 4 both 0
  541.             particleEditCompAverageValue;
  542.         text -l "Average Value" ;
  543.         floatField -ed 0 particleEditCompAverageValueX;
  544.         floatField -ed 0 particleEditCompAverageValueY;
  545.         floatField -ed 0 particleEditCompAverageValueZ;
  546.         setParent ..;
  547.  
  548.         rowLayout -nc 4
  549.             -cat 1 right 5
  550.             -cat 2 both 0
  551.             -cat 3 both 0
  552.             -cat 4 both 0
  553.             particleEditCompMaxAverageOffset;
  554.         text -l "Max Offset from Average";
  555.         floatField -ed 0 particleEditCompMaxAverageOffsetX;
  556.         floatField -ed 0 particleEditCompMaxAverageOffsetY;
  557.         floatField -ed 0 particleEditCompMaxAverageOffsetZ;
  558.         setParent ..;
  559.     
  560.         setUITemplate -ppt;
  561.     
  562.         button -l "Set Attribute" 
  563.             -c ("pEditCompSetAttrCB "
  564.                 +$nodeName+" "
  565.                 +$attrName+" "
  566.                 +$attrType)
  567.             pEditCompSetAttrBtn;
  568.  
  569.         button -l "Get Attribute" 
  570.             -c ("pEditCompGetAttrCB "
  571.                 +$nodeName+" "
  572.                 +$attrName+" "
  573.                 +$attrType)
  574.             pEditCompGetAttrBtn;
  575.         button -l "Close"
  576.             -c ("window -e -vis 0 pEditCompWin")
  577.                 pEditCompWinCloseButton;
  578.  
  579.         separator -hr true -h 20 particleEditWndSeparator;
  580.         
  581.         tabLayout -tabsVisible false 
  582.             -cr true  
  583.             -scrollable true
  584.             -hst 0 -vst 0
  585.             pEditCompValsTL;
  586.         setParent ..;
  587.     setParent ..;
  588.  
  589.         formLayout -e 
  590.             -af  pEditCompCL top 4
  591.             -af  pEditCompCL right 0
  592.             -af  pEditCompCL left 0
  593.             -an  pEditCompCL bottom 
  594.             
  595.             -ac pEditCompValsTL top 0 pEditCompCL
  596.             -af pEditCompValsTL left 0 
  597.             -af pEditCompValsTL right 0 
  598.             -ac pEditCompValsTL bottom 0 particleEditCompAverageValue
  599.             
  600.             -af particleEditCompAverageValue left 0
  601.             -af particleEditCompAverageValue right 0
  602.             -an particleEditCompAverageValue top 
  603.             -ac particleEditCompAverageValue bottom 0 particleEditCompMaxAverageOffset
  604.  
  605.             -af particleEditCompMaxAverageOffset left 0
  606.             -af particleEditCompMaxAverageOffset right 0
  607.             -an particleEditCompMaxAverageOffset top 
  608.             -ac particleEditCompMaxAverageOffset bottom 0 particleEditWndSeparator
  609.  
  610.             -an particleEditWndSeparator top 
  611.             -af particleEditWndSeparator left 0
  612.             -af particleEditWndSeparator right 0
  613.             -af particleEditWndSeparator bottom 30
  614.  
  615.             -ac  pEditCompSetAttrBtn top 0 particleEditWndSeparator
  616.                     -ap  pEditCompSetAttrBtn left 0  2
  617.                     -ap  pEditCompSetAttrBtn right 0  32
  618.                     -af  pEditCompSetAttrBtn bottom 5
  619.  
  620.                     -ac  pEditCompGetAttrBtn top 0 particleEditWndSeparator
  621.                     -ap  pEditCompGetAttrBtn left 0  34
  622.                     -ap  pEditCompGetAttrBtn right 0  66
  623.                     -af  pEditCompGetAttrBtn bottom 5
  624.             
  625.             -ac pEditCompWinCloseButton top 0 particleEditWndSeparator
  626.             -ap pEditCompWinCloseButton left 0  68
  627.             -ap pEditCompWinCloseButton right 0  98
  628.             -af pEditCompWinCloseButton bottom 5 
  629.             
  630.             pEditCompBtnsF;
  631.     
  632.  
  633.         // start building the widgets
  634.         //
  635.         setParent  pEditCompCL;
  636.             textFieldGrp -l "Object Name" 
  637.                 -text $nodeName
  638.                 -cc ("pEditCompObjNameCB #1")
  639.                 pEditCompObjTF;
  640.  
  641.             textFieldGrp -l "Attribute Name" 
  642.                 -text $attrName
  643.                 -cc ("pEditCompAttrNameCB #1")
  644.                 pEditCompAttrTF;
  645.         
  646.                radioButtonGrp
  647.                 -l "Edit"
  648.                        -l2 "Entire Object"
  649.                        -l1 "Selected Components"
  650.             -cc2 ("pEditCompSelectTypeCB "
  651.                 +$nodeName+" "
  652.                 +$attrName+" "
  653.                 +$attrType+" 2")
  654.             -cc1 ("pEditCompSelectTypeCB "
  655.                 +$nodeName+" "
  656.                 +$attrName+" "
  657.                 +$attrType+" 1")
  658.                        -nrb 2
  659.                        pEditCompRB;
  660.             radioButtonGrp -e -select 1 pEditCompRB; 
  661.  
  662.             checkBoxGrp -ncb 2  
  663.                 -l " "
  664.                 -l1 "Relative"
  665.                 -l2 "Save Initial State"
  666.                 -v2 1
  667.                 particleRelativeCB;
  668.  
  669.         // create the widgets for the tabLayout
  670.         setParent pEditCompValsTL;
  671.             columnLayout pEditCompFloatValsCL;
  672.             
  673.             frameLayout -bv 0 -cll false -lv false ;
  674.                 columnLayout;
  675.                 floatSliderGrp -l "Attribute Value"
  676.                     -field true
  677.                     -min -10 -max 10
  678.                     -fmn $dynMinFloatField 
  679.                     -fmx $dynMaxFloatField
  680.                     -pre 3 -step 0.1
  681.                     particleComponentVal;
  682.     
  683.                 floatSliderGrp -l "Random Offset"
  684.                     -field true
  685.                     -min 0 -max 10
  686.                     -fmn 0 -fmx $dynMaxFloatField
  687.                     -pre 3 -step 0.1
  688.                     particleRandomOffset;
  689.                 setParent ..;
  690.             setParent ..;
  691.             setParent ..; // columnLayout
  692.     
  693.             columnLayout pEditCompVecValsCL;
  694.     
  695.             frameLayout  -bv 0
  696.                 -cll false 
  697.                 -l "Attribute Value";
  698.                 columnLayout;
  699.                     floatSliderGrp -l "X"
  700.                         -field true
  701.                         -min -10 -max 10
  702.                         -fmn $dynMinFloatField
  703.                         -fmx $dynMaxFloatField
  704.                         -pre 3 -step 0.1
  705.                         particleComponentValX;
  706.                     floatSliderGrp -l "Y"
  707.                         -field true
  708.                         -min -10 -max 10
  709.                         -fmn $dynMinFloatField 
  710.                         -fmx $dynMaxFloatField
  711.                         -pre 3 -step 0.1
  712.                         particleComponentValY;
  713.                     floatSliderGrp -l "Z"
  714.                         -field true
  715.                         -min -10 -max 10
  716.                         -fmn $dynMinFloatField 
  717.                         -fmx $dynMaxFloatField
  718.                         -pre 3 -step 0.1
  719.                         particleComponentValZ;
  720.                 setParent ..;
  721.             setParent ..;
  722.             separator;
  723.             frameLayout  
  724.                 -bv 0
  725.                 -cll false 
  726.                 -l "Random Offset";
  727.                 columnLayout;
  728.                     floatSliderGrp -l "X"
  729.                         -field true
  730.                         -min 0 -max 10
  731.                         -fmn 0 -fmx $dynMaxFloatField
  732.                         -pre 3 -step 0.1
  733.                         particleRandomOffsetX;
  734.                     floatSliderGrp -l "Y"
  735.                         -field true
  736.                         -min 0 -max 10
  737.                         -fmn 0 -fmx $dynMaxFloatField
  738.                         -pre 3 -step 0.1
  739.                         particleRandomOffsetY;
  740.                     floatSliderGrp -l "Z"
  741.                         -field true
  742.                         -min 0 -max 10
  743.                         -fmn 0 -fmx $dynMaxFloatField
  744.                         -pre 3 -step 0.1
  745.                         particleRandomOffsetZ;
  746.                 setParent ..;
  747.             setParent ..;
  748.  
  749.         setParent ..;  // columnLayout
  750.         setParent ..;  // tabLayout
  751.  
  752.  
  753.     setUITemplate -ppt;
  754.  
  755.     }
  756.     else
  757.     {
  758.     
  759.         textFieldGrp -e
  760.             -text $nodeName
  761.             pEditCompObjTF;
  762.  
  763.         textFieldGrp -e
  764.             -text $attrName
  765.             pEditCompAttrTF;
  766.  
  767.         button -e
  768.             -c ("pEditCompSetAttrCB "
  769.                 +$nodeName+" "
  770.                 +$attrName+" "
  771.                 +$attrType)
  772.             pEditCompSetAttrBtn;
  773.  
  774.         button -e
  775.             -c ("pEditCompGetAttrCB "
  776.                 +$nodeName+" "
  777.                 +$attrName+" "
  778.                 +$attrType)
  779.             pEditCompGetAttrBtn;
  780.  
  781.         // make sure everything is enabled when a new attribute 
  782.         // is selected from the attribute editor
  783.         textFieldGrp -e -en 1 pEditCompObjTF;
  784.         textFieldGrp -e -en 1 pEditCompAttrTF;
  785.         checkBoxGrp -e -en 1 particleRelativeCB;
  786.         radioButtonGrp -e -en 1 pEditCompRB;
  787.         tabLayout -e -en 1 pEditCompValsTL;
  788.  
  789.         rowLayout -e -en 1 particleEditCompAverageValue;
  790.         rowLayout -e -en 1 particleEditCompMaxAverageOffset;
  791.         
  792.         int $RBselected = `radioButtonGrp -q -sl pEditCompRB`;
  793.         pEditCompSelectTypeCB $nodeName $attrName $attrType $RBselected;
  794.  
  795.     }
  796.  
  797.     if ($attrType == "Float")
  798.     {
  799.         floatSliderGrp -e -v 0.0  particleComponentVal;
  800.         floatSliderGrp -e -v 0.0  particleRandomOffset;
  801.         tabLayout -e 
  802.             -selectTab pEditCompFloatValsCL 
  803.             pEditCompValsTL;
  804.         radioButtonGrp -e
  805.                 -cc2 ("pEditCompSelectTypeCB "
  806.                     +$nodeName+" "
  807.                     +$attrName+" "
  808.                     +" Float 2")
  809.                 -cc1 ("pEditCompSelectTypeCB "
  810.                     +$nodeName+" "
  811.                     +$attrName+" "
  812.                     +" Float 1")
  813.                         pEditCompRB;
  814.     }
  815.     else
  816.     {
  817.         floatSliderGrp -e -v 0.0 particleComponentValX;
  818.         floatSliderGrp -e -v 0.0 particleComponentValY;
  819.         floatSliderGrp -e -v 0.0 particleComponentValZ;
  820.         floatSliderGrp -e -v 0.0 particleRandomOffsetX;
  821.         floatSliderGrp -e -v 0.0 particleRandomOffsetY;
  822.         floatSliderGrp -e -v 0.0 particleRandomOffsetZ;
  823.  
  824.         pEditCompSetSliderLabels($attrName);
  825.  
  826.         tabLayout -e 
  827.             -selectTab pEditCompVecValsCL 
  828.             pEditCompValsTL;
  829.         radioButtonGrp -e
  830.                 -cc2 ("pEditCompSelectTypeCB "
  831.                     +$nodeName+" "
  832.                     +$attrName+" "
  833.                     +" Vector 2")
  834.                 -cc1 ("pEditCompSelectTypeCB "
  835.                     +$nodeName+" "
  836.                     +$attrName+" "
  837.                     +" Vector 1")
  838.                         pEditCompRB;
  839.     }
  840.  
  841.     pEditCompGetAttrCB($nodeName, $attrName, $attrType);
  842.     int $RBselected = `radioButtonGrp -q -sl pEditCompRB`;
  843.     pEditCompSelectTypeCB $nodeName $attrName $attrType $RBselected;
  844.  
  845.     setUITemplate -ppt;
  846.  
  847.     showWindow pEditCompWin;
  848.  
  849. } // AEparticleEditComponent
  850.